<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改产品补助金申请记录')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-partsQrcodeApply-edit" th:object="${zsyhPartsQrcodeApply}">
            <input name="id" th:field="*{id}" type="hidden">
            <h4 class="form-header h4">申请产品基础信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">产品主图：</label>
                        <div class="col-sm-8">
                            <p class="user-info-head" onclick="avatar()"><img id="attributeLogo" class="img-thumbnail img-lg" th:src="*{attributeLogo}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">产品名称：</label>
                        <div class="col-sm-8">
                            <input name="attributeId" th:field="*{attributeName}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">二维码编码：</label>
                        <div class="col-sm-8">
                            <input name="qrcodeId" th:field="*{qrcodeId}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">故障描述：</label>
                        <div class="col-sm-8">
                            <textarea name="faultDetails" class="form-control" readonly>[[*{faultDetails}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">故障凭证：</label>
                        <div class="col-xs-10">
                            <input type="hidden" name="faultImages" th:field="*{faultImages}">
                            <div class="file-loading">
                                <input class="form-control file-upload" id="faultImages" name="file" type="file">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">厂家名称：</label>
                        <div class="col-sm-8">
                            <input name="factoryName" th:field="*{factoryName}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">厂家电话：</label>
                        <div class="col-sm-8">
                            <input name="factoryPhone" th:field="*{factoryPhone}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">状态：</label>
                        <div class="col-sm-8">
                            <select name="applyStatus" style="border: 0;appearance:none;" class="form-control m-b" th:with="type=${@dict.getType('apply_status')}" readonly>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{applyStatus}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">是否转账：</label>
                        <div class="col-sm-8">
                            <select name="isTransfer" style="border: 0;appearance:none;" class="form-control m-b" th:with="type=${@dict.getType('zsyh_yesno')}" readonly>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isTransfer}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">申请人信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">申请人姓名：</label>
                        <div class="col-sm-8">
                            <input name="repairId" th:field="*{storePerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">申请人联系方式：</label>
                        <div class="col-sm-8">
                            <input name="repairId" th:field="*{storePhone}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">市县鉴定信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">市县级鉴定人：</label>
                        <div class="col-sm-8">
                            <input name="storeId" th:field="*{partsStorePerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">鉴定人联系方式：</label>
                        <div class="col-sm-8">
                            <input name="storeId" th:field="*{partsStorePhone}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">市县鉴定结果：</label>
                        <div class="col-sm-8">
                            <textarea name="auditContent" class="form-control" readonly>[[*{auditContent}]]</textarea>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">市县鉴定时间：</label>
                        <div class="col-sm-8">
                            <input name="auditTime" th:value="${#dates.format(zsyhPartsQrcodeApply.auditTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">大区鉴定信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">所属大区：</label>
                        <div class="col-sm-8">
                            <input name="agentId" th:field="*{agentName}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">大区鉴定人：</label>
                        <div class="col-sm-8">
                            <input name="agentId" th:field="*{agentPerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">大区鉴定内容：</label>
                        <div class="col-sm-8">
                            <textarea name="agentContent" class="form-control" readonly>[[*{agentContent}]]</textarea>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">大区鉴定时间：</label>
                        <div class="col-sm-8">
                            <input name="agentTime" th:value="${#dates.format(zsyhPartsQrcodeApply.agentTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">后台转账人：</label>
                        <div class="col-sm-8">
                            <input name="platformPerson" th:field="*{platformPerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">后台转账时间：</label>
                        <div class="col-sm-8">
                            <input name="platformTime" th:value="${#dates.format(zsyhPartsQrcodeApply.platformTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>-->

            <h4 class="form-header h4">平台审核信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">审核人：</label>
                        <div class="col-sm-8">
                            <input name="transferPerson" th:field="*{platformPerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">审核时间：</label>
                        <div class="col-sm-8">
                            <input name="transferTime" th:value="${#dates.format(zsyhPartsQrcodeApply.platformTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">后台审核备注：</label>
                        <div class="col-sm-8">
                            <textarea name="platformRemarks" class="form-control" readonly>[[*{platformRemarks}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">补助金转账信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">转账人：</label>
                        <div class="col-sm-8">
                            <input name="transferPerson" th:field="*{transferPerson}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">转账时间：</label>
                        <div class="col-sm-8">
                            <input name="transferTime" th:value="${#dates.format(zsyhPartsQrcodeApply.transferTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd hh:mm:ss" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/partsQrcodeApply";
        $("#form-partsQrcodeApply-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-partsQrcodeApply-edit').serialize());
            }
        }

        $("input[name='transferTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='auditTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='agentTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='platformTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val();
            var imageArr = val.split("|");
            $(this).fileinput({
                'uploadUrl': ctx + 'common/uploadOSS',
                initialPreviewAsData: true,
                initialPreview: imageArr,
                maxFileCount: 1,
                showRemove: false,/*是否显示移除按钮*/
                showUpload: false,/*是否显示上传按钮*/
                showBrowse: false,/*是否显示浏览按钮,选择按钮*/
                showCaption: false, /*是否显示被选文件的简介*/
                autoReplace: true,
                layoutTemplates: {
                    actionDelete:'',
                    actionUpload:''
                } /*去掉缩略图上的删除和上传按钮*/
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });

        function avatar() {
            var url = ctx + 'zsyh/partsQrcodeApply/avatar?attributeLogo='+$("#attributeLogo").val();
            layer.open({
                type: 2,
                area: [$(window).width()/2 + 'px', $(window).height() + 'px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: "查看产品主图",
                content: url,
                btnClose: 1,
                // 弹层外区域关闭
                shadeClose: true,
                yes: function(index, layero) {
                    debugger;
                    var iframeWin = layero.find('iframe')[0];
                    var imageUrl = layero.find('iframe')[0].contentWindow.$("#imageUrl").val();
                    iframeWin.contentWindow.submitHandler(index, layero);
                },
                cancel: function(index) {
                    return true;
                }
            });
        }

    </script>
</body>
</html>